# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys


class SearchWid(QWidget):
    def __init__(self):
        super(SearchWidget,self).__init__()
        self.setUi()
    def setUi(self):
        def searchItem( name ):
            label = QLabel(name)
            edit = QLineEdit()
            return label,edit
        ly = QGridLayout()         
        label = QLabel(u"检索")           
        ly.addWidget(label,0,0)
        self.itemList = []
        self.itemList.append(searchItem(u"项目"))
        self.itemList.append(searchItem(u"模式"))
        self.itemList.append(searchItem(u"网络"))
        self.itemList.append(searchItem(u"版本"))
        self.itemList.append(searchItem(u"日期"))
        ly = QGridLayout()
        for i in range(len(self.itemList)):
            ly.addWidget(self.itemList[i][0],i,0)
            ly.addWidget(self.itemList[i][1],i,1)
        
        vbox = QVBoxLayout()
        vbox.addLayout(ly)        
        vbox.addStretch(1)
        vbox.addWidget(QPushButton(u"搜索"))
        hbox = QHBoxLayout()
        hbox.addLayout(vbox)
        
        self.setLayout(hbox)
        
class ResultWid(QScrollArea):
    def __init__(self):
        super(ResultWid,self).__init__()
        text = QTextEdit()
        text.setFixedWidth(10000)
        self.setWidget(text)  
        
if __name__ == "__main__":
    app = 0
    app = QApplication(sys.argv)
    w = ResultWid()
    w.show()
    sys.exit(app.exec_())
        